/** * @author Yuriy Ustymenko */
import java.io.*;
import java.util.*;
import java.lang.*;
public class Numbers {
	static final int FirstNumber = 2;
    static final int Step = 2;
    private List<Integer> primeNumbers;
    public List<Integer> getPrimeNumbers(int introductionNumber) {
        primeNumbers = new ArrayList<Integer>();

        primeNumbers.add(FirstNumber);

        for (int i = FirstNumber + 1; i <= introductionNumber; i=i+ Step) {
        	
            if (isPrime(i)) {
                primeNumbers.add(i);
            }
        }

        return primeNumbers;
    }
    
    static boolean num(int x){
        for (int i=2; i<x; i++)
        {
            if(x%i==0)return false;
        }
        return true;
    }
    private boolean isPrime(int number) {
        for (int i = 2; i < primeNumbers.size(); i++)
            if (number % primeNumbers.get(i) == 0)
                return false;
        return true;
    }
	public static void main (String args[]) throws IOException

    {
		
		Scanner in = new Scanner(System.in);
        System.out.print("Input number:");
        int introductionNumber = in.nextInt();

        Numbers primeNumbersFinder = new Numbers();
        List<Integer> primes = primeNumbersFinder.getPrimeNumbers(introductionNumber);

        System.out.println("Prime numbers:");
        System.out.println(Arrays.toString(primes.toArray()));
    }
    

}

